<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<title> 我的订单 - LooPo-乐铺 </title>
<?php include VIEWS.'header.html'?>

<style type="text/css">
.tt{
    width: 96%;
    padding: 0;
}

.tt td{
    border-bottom: 1px dotted #CCCCCC;
    font-size: 12px;
}

.ti {
    line-height: 150%;
}
</style>

</head>

<body>

<?php include VIEWS.'topbar.html'?>

<div id="content">

    <?php include VIEWS.'leftnav.html'?>

    <div id="right">

    <h1>我的订单</h1>


<h3 style="margin-bottom:5px"><img src="/images/icon_arrow_down.gif" /><?php if(count($detail['list'])):?><?php echo $data['id']?>号订单详情<?php elseif($data['archive']):?>以下是您在乐铺所有存档订单<?php else:?>以下是近期您在乐铺的有效订单<?php endif?></h3>
<hr size="1" />
<?php if(count($detail['list'])):?>

<?php
if($list[0]['stat']==0):
//这里是 $CFG['indent_expire'] 天的付款期限，需要根据实际情况来改
?>
<div class="goodbox roundNormal">&nbsp;&nbsp;&nbsp;乐铺多嘴：距本订单的付款期限还有
<?php
//付款期限
$limit = ($list['0']['created'] + 3600*24*$CFG['indent_expire'] - time())/3600;
echo $limit > 1  ? '约 '.ceil($limit).' 小时' : '约 '.floor($limit*60).' 分钟' ?>。&nbsp;(<a href="/faq.php/26" target="_blank">这是什么？</a>)</div><br clear="all" />
<?php endif?>

<form method="post" action="" id="updateform">
<?php echo round_table('100%', ($list[0]['stat']=='-1' ? 'CCCCCC' : '244890'), 'white', 3, 3, 'top')?>
<table cellpadding="4" width="100%" cellspacing="0" border="0">
<tr style="background-color:<?php echo $list[0]['stat']=='-1' ? '#CCCCCC' : '#244890;color:#FFF'?>;font-weight:bold"><td class="px12">物品名称</td><td class="px12">数量</td><td class="px12">价格</td></tr>

<?php
error_reporting(0);
foreach($detail['list'] as $v):
$detail_i++;
?>
<tr style="font-size:14px;background-color:<?php echo $detail_i%2==0 ? '#EEEEEE' : '#F9F9F9'?>"><td style="padding:10px"><?php if($list[0]['stat']!='-1'):?><a href="/items.php/<?php echo $v['iid']?>" target="_blank"><?php endif?><?php echo $v['iname']?><?php if($list[0]['stat']!='-1'):?></a><?php endif?></td><td><?php echo $v['amount']?> X <?php echo $v['price']?></td><td>&yen; <span id="price<?php echo $v['id']?>"><?php echo $v['amount']*$v['price']?></span></td></tr>
<?php endforeach?>

<tr style="font-weight:bold;"><td style="border-top:1px dotted #244890; padding-top:10px">小计：</td><td style="border-top:1px dotted #244890"><span id="totalamount"><?php echo $detail['totalamount']?></span></td><td style="border-top:1px dotted #244890">&yen; <span id="totalprice"><?php echo $list[0]['sumfee'];?></span></td></tr>
<?php if($list[0]['adjustfee']!='0.00'):?><tr style="font-weight:bold"><td>折扣：</td><td>-</td><td>&yen; <?php echo $list[0]['adjustfee'];?></td></tr><?php endif?>
<tr style="font-weight:bold"><td style="border-bottom:1px dotted #244890; padding-bottom:10px">运费：</td><td style="border-bottom:1px dotted #244890; padding-bottom:10px">-</td><td style="border-bottom:1px dotted #244890; padding-bottom:10px">&yen; <?php echo $list[0]['postfee'];?></td></tr>
<tr style="font-weight:bold; color:#FF6240"><td>合计：</td><td>-</td><td>&yen; <?php echo $list[0]['postfee']+$list[0]['sumfee']+$list[0]['adjustfee'];?></td></tr>
</table>
<hr size="1" />
<?php echo round_table('100%', ($list[0]['stat']=='-1' ? 'CCCCCC' : '244890'), 'white', 3, 3, 'top')?>
<table cellpadding="4" width="100%" cellspacing="0" border="0">
<tr style="background-color:<?php echo $list[0]['stat']=='-1' ? '#CCCCCC' : '#244890;color:#FFF'?>;"><td style="font-weight:bold" class="px12" colspan="2">收货信息</td></tr>
<tr><td width="10%" nowrap="" class="px12"><b>收货人：</b></td><td class="px12"><?php if($list[0]['stat']==0):?><input class="px12 input1" tabindex="1" id="linkman" type="text" name="linkman" maxlength="30" size="10" value="<?php echo $list[0]['linkman']?>" /><?php else: echo $list[0]['linkman']; endif?></td></tr>
<tr><td class="px12"><b>电话：</b></td><td class="px12"><?php if($list[0]['stat']==0):?><input class="px12 input1" tabindex="1" id="tel" type="text" name="tel" maxlength="20" size="12" value="<?php echo $list[0]['tel']?>" /><?php else: echo $list[0]['tel']; endif?></td></tr>
<tr><td class="px12"><b>地址：</b></td><td style="font-size:12px"><?php if($list[0]['stat']==0):?><input class="px12 input2" tabindex="1" id="address" type="text" name="address" maxlength="100" size="46" value="<?php echo $list[0]['address']?>" /><?php else: echo $list[0]['address']; endif?></td></tr>
<tr><td class="px12"><b>邮编：</b></td><td style="font-size:12px"><?php if($list[0]['stat']==0):?><input class="px12 input0" tabindex="1" id="zipcode" type="text" name="zipcode" maxlength="6" size="7" value="<?php echo $list[0]['zipcode']?>" /><?php else: echo $list[0]['zipcode']; endif?></td></tr>
</table>
<br />

<?php if($list[0]['stat']>=3):?>
<?php echo round_table('100%', ($list[0]['stat']=='-1' ? 'CCCCCC' : '244890'), 'white', 3, 3, 'top')?>
<table id="postinfo" cellpadding="4" width="100%" cellspacing="0" border="0">
<tr style="background-color:<?php echo $list[0]['stat']=='-1' ? '#CCCCCC' : '#244890;color:#FFF'?>"><td style="font-weight:bold" class="px12" colspan="2">发货信息</td></tr>
<tr><td width="10%" nowrap="" class="px12"><b>发货方式：</b></td><td class="px12"><?php echo $list[0]['posttype']?></td></tr>
<tr><td class="px12"><b>物流单号：</b></td><td class="px12"><?php echo $list[0]['postnum']?></td></tr>
<tr><td colspan="2" class="px12">
    <?php echo '&nbsp; &nbsp;'.post_query_link($data['list'][0]['posttype'], $data['list'][0]['postnum']);?>
    <?php do_action('view_myindent_postinfo', array('data'=>$list));?>
</td></tr>
</table>
<br />
<?php endif?>

<?php if($list[0]['stat']!=0 && $list[0]['memo'] || $list[0]['stat']==0):?>
<?php echo round_table('100%', ($list[0]['stat']=='-1' ? 'CCCCCC' : '244890'), 'white', 3, 3, 'top')?>
<table cellpadding="4" width="100%" cellspacing="0" border="0">
<tr style="background-color:<?php echo $list[0]['stat']=='-1' ? '#CCCCCC' : '#244890;color:#FFF'?>"><td style="font-weight:bold" class="px12" colspan="2">附言</td></tr>
<tr><td class="px12"><?php if($list[0]['stat']==0):?><textarea class="px12" name="memo" rows="5" cols="60"><?php echo $list[0]['memo']?></textarea><?php else: echo nl2br($list[0]['memo']); endif?></td></tr>
</table>
<br />
<?php endif?>

<?php if($list[0]['log']):?>
<?php echo round_table('100%', ($list[0]['stat']=='-1' ? 'CCCCCC' : '244890'), 'white', 3, 3, 'top')?>
<table cellpadding="4" width="100%" cellspacing="0" border="0">
<tr style="background-color:<?php echo $list[0]['stat']=='-1' ? '#CCCCCC' : '#244890;color:#FFF'?>"><td style="font-weight:bold" class="px12" colspan="2">订单跟踪</td></tr>
<tr><td class="px12"><?php echo nl2br($list[0]['log'])?></td></tr>
</table>
<hr size="1" />
<?php endif?>
<?php
/*
-1.订单过期
0.未支付
1.已支付
2.已收款
3.已发货
4.订单完成
*/
switch($list[0]['stat']) {
    case -1:        echo '<!--<input class="darkbtn" type="submit" value="存档订单不能修改" disabled>-->'; break;
    case 0:         echo '<input tabindex="2" class="redbtn" type="button" value="现在付款" onclick="javascript:location.href=\'/pay.php/'. $data['id'] .'\'">&nbsp;&nbsp;<input tabindex="2" class="greenbtn" type="submit" name="stat0" value="标记为已付款">&nbsp;&nbsp;<input tabindex="2" class="bluebtn" type="submit" value="更新收货信息">&nbsp;&nbsp;<input tabindex="2" class="darkbtn" type="submit" name="stat-1" value="取消该订单" onclick="javascript:if(!confirm(\'您确认要取消这笔订单吗？该操作无法撤销哦！\')) return false;">'; break;
    case 1:         echo '<input tabindex="2" class="darkbtn" type="submit" name="stat1" value="标记为未付款">'; break;
    case 2:         echo '<input class="bluebtn" type="submit" name="stat4" value="确认收到物品" disabled>'; break;
    case 3:         echo '<input tabindex="2" class="bluebtn" type="submit" name="stat4" value="确认收到物品" style="font-weight:bold">'; break;
    case 4:         echo '<input class="bluebtn" type="submit" name="stat4" value="订单已完成" style="font-weight:bold" disabled>'; break;
    default:        echo '<input type="submit" name="stat3" value="确认收到物品" style="font-weight:bold" disabled>'; break;
}
?>
</form>
<br /><br />

<?php else:?>

<?php if(!count($list)):?>
<div class="errbox roundNormal" style="width:95%">&nbsp;&nbsp;&nbsp;没有找到相对应的订单</div><br />
<?php else:?>
<?php echo round_table('96%', ($data['archive'] ? 'CCCCCC' : '244890'), 'white', 3, 3, 'top')?>
<table class="tt" cellspacing="0">
<tr class="ti" style="font-weight:bold;background-color:<?php echo $data['archive'] ? '#CCCCCC' : '#244890;color:#FFF'?>"><td>&nbsp;订单号</td><td>收货人</td><td>订单金额</td><td>状态</td><td>更新日期</td><td>操作</td></tr>
<?php
foreach($list as $v):
$indent_i++;
?>
<tr class="ti" style="font-size:14px;background-color:<?php echo $indent_i%2==0 ? '#EEEEEE' : '#F9F9F9'?>"><td style="padding:6px"><b><?php echo $v['id']?></b></td><td> <?php echo $v['linkman']?> </td><td style="font-weight:bold"> &yen; <?php echo $v['sumfee']+$v['postfee']+$v['adjustfee']?> </td><td>
<?php
switch($v['stat']) {
    case -1:        echo '<font color="#CCCCCC"><b>存档订单</b></font>'; break;
    case 1:         echo '<font color="red"><b>已支付，待确认</b></font>'; break;
    case 2:         echo '<font color="green"><b>确认收款，备货中</b></font>'; break;
    case 3:         echo '<font color="green"><b>物品已发出</b></font>'; break;
    case 4:         echo '<font color="blue"><b>订单已完成</b></font>'; break;
    case 0:default: echo '<b>等待付款</b>';
}
?>
</td><td style="font-size:11px;font-family:verdana"> <?php echo date('y-m-d', $v['updated'])?> </td><td>
<?php if($v['stat']==0):?><a title="为 <?php echo $v['id']?> 号订单付款" tabindex="1" href="/pay.php/<?php echo $v['id']?>"><b>马上付款</b></a>&nbsp; <?php endif?>
<a tabindex="1" href="/myIndent.php/id/<?php echo $v['id']?>">查看详情</a>
</td></tr>
<?php endforeach?>
</table>
<br />
<?php endif?>


<?php
if($page['next']):?>
<div style="text-align:right;"><a class="px12" tabindex="2" href=<?php echo $page['url']?>p=<?php echo $page['next']?>>更早的订单</a> &nbsp; &nbsp; </div>
<?php endif;?>

<br clear="all" />
<h3 style="margin:0"><img src="/images/icon_arrow_right.gif" /><?php if(!$data['archive']):?><a tabindex="2" href="/myIndent.php/show/archive">查看存档订单</a><?php else:?><a tabindex="2" href="/myIndent.php/show/active">查看活动订单</a><?php endif?></h3>

<?php endif?>

<?php if(count($detail['list'])):?><a class="px12" tabindex="2" href="/myIndent.php/show/<?php echo $list[0]['stat']=='-1' ? 'archive' : 'active'?>">返回订单列表</a><?php endif?>

    </div>
</div>

<?php include VIEWS.'copyright.html'?>

</body>
</html>
